< previous page page_233 next page >

Page 233
e10a6a0a59f035e870d90cca05b85fce.gif
Private Sub LoadImages(file_name As String)
Dim base As String
Dim i As Integer
Dim bm As BITMAP

    ' Get the base file name. 
    base = Left$(file_name, Len(file_name) - 5) 

    ' Get the first image. 
    picCanvas.AutoSize = True 
    picCanvas.Picture = LoadPicture(base & "0.bmp") 

    ' See how big it is.
    GetObject picCanvas.Image, Len(bm), bm
    BytesPerImage = bm.bmWidthBytes * bm.bmHeight

    ' Make room for the bitmap bits.
    MaxImage = NumImages - 1
    ReDim Bytes(1 To BytesPerImage, 0 To MaxImage)

    ' Load the images.
    On Error GoTo LoadPictureError
    For i = 0 To MaxImage
        ' Load the picture.
        picFrame.Picture = _
            LoadPicture(base & Format$(i) & ".bmp")

        ' Grab the image's bits.
        GetBitmapBits picFrame.Image, BytesPerImage, _
            Bytes(1, i)
    Next i
End Sub 

' Run the animation once or until Playing is False.
Private Sub PlayImagesOnce(ByVal ms_per_frame As Integer)
Dim i As Integer
Dim next_time As Long

    ' Get the current time.
    next_time = GetTickCount

    ' Start the animation.
    For i = 0 To NumImages - 1
        ' Display the next frame.
        SetBitmapBits picCanvas.Image, _
            BytesPerImage, Bytes(1, i)
        picCanvas.Refresh
        NumPlayed = NumPlayed + 1

        ' Wait till we should display the next frame.

 
< previous page page_233 next page >